home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / RCSC.ZIP / LIB51 / ITOA.C < prev    next >
C/C++ Source or Header  |  1997-01-12  |  292b  |  17 lines

  1. /*
  2. ** itoa(n,s) - Convert n to characters in s 
  3. */
  4. itoa(n, s) char *s; int n; {
  5.   int sign;
  6.   char *ptr;
  7.   ptr = s;
  8.   if ((sign = n) < 0) n = -n;
  9.   do {
  10.     *ptr++ = n % 10 + '0';
  11.     } while ((n = n / 10) > 0);
  12.   if (sign < 0) *ptr++ = '-';
  13.   *ptr = '\0';
  14.   reverse(s);
  15.   }
  16.  
  17.